import { getUsers, setUsers } from '../configuration';
import { QuickPick } from '../helper/QuickPick';
import { Memory } from '../memory';

/**
 * 删除一个用户
 * @date 1/24/2024 - 6:25:38 PM
 *
 * @export
 * @async
 * @returns {Promise<void>}
 */
export async function removeUser(): Promise<void> {
  const users = await getUsers();
  QuickPick.show(users, user => `${user.username} ${user.url}`).then(idx => {
    const user = users.splice(idx, 1)[0];
    setUsers(users);
    Memory.removeMemory(user);
  });
}